package com.doublethread.easymart.common.exception;

import com.doublethread.easymart.common.result.ResultCode;

/**
 * 权限认证异常工具类
 */
public class AuthException {

    /**
     * 未授权访问异常
     */
    public static void unauthorized() {
        throw new BusinessException(ResultCode.UNAUTHORIZED);
    }

    /**
     * 禁止访问异常
     */
    public static void forbidden() {
        throw new BusinessException(ResultCode.FORBIDDEN);
    }

    /**
     * 权限不足异常
     */
    public static void accessDenied() {
        throw new BusinessException(ResultCode.ACCESS_DENIED);
    }

    /**
     * 未提供认证凭证异常
     */
    public static void missingToken() {
        throw new BusinessException(ResultCode.UNAUTHORIZED);
    }
}